identify the relative max and min from a graph